#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableWarChessHeroDao:DaoBase<TableWarChessHero>
    {
        public override string GetFileName()
        {
            return "TableWarChessHero.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableWarChessHero>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableWarChessHero model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.heroId)) UnityEngine.Debug.LogError("数据表id重复:TableWarChessHero->id: " + model.heroId);
            #endif
            cachePrimaryInt[model.heroId] = model;
        }
        protected override TableWarChessHero ParseRowData(string[] rowData)
        {
            TableWarChessHero data = new TableWarChessHero();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.heroId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.moveRange = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.fightBackCount = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.defaultSkillId = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.heroType = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.heroStyle = string.Intern(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.atk = double.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.def = double.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.hp = double.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.speed = double.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.cri = double.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.anticri = double.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.hit = double.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.dodge = double.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.activeSkills = rowData[14];
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.skills = rowData[15];
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.passiveSkills = rowData[16];
            }
            return data;
        }
    }
}
